package com.demo.controller;

import com.alibaba.fastjson.JSON;
import com.demo.model.dto.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 测试过滤器和拦截器在处理请求过程中的执行顺序
 * 分别有两个过滤器和两个拦截器
 * 代码位于com/demo/function/filter和com/demo/function/spring/interceptor
 */
@Slf4j
@RestController
public class FilterController {

    @GetMapping("/filter/process/get")
    public String process(@RequestParam("content") String content) {
      log.info("测试filter和intterceptor执行顺序, 请求内容：" + content);
      return "success";
    }

    @PostMapping("/filter/process/post/body")
    public String processV2(@RequestBody Tag tag) {
        log.info("processV2请求内容：" + JSON.toJSONString(tag));
        return "success";
    }

    @PostMapping("/filter/process/post/form")
    public String processPostForm(Tag tag) {
        log.info("process/post/form 请求内容：" + JSON.toJSONString(tag));
        return "success";
    }
}
